<?php

include '../../DB/dbConnection.php';

$result=array();

if ($_POST){
	
	$query="SELECT * FROM admin WHERE user='".$_POST['name']."' AND password='".$_POST['pass']."'";
		
	$stmt = $conn->prepare($query);
	$success = $stmt->execute();
	$stmt->bind_result($id, $user, $password);

	$count = 0;
	$tmp=array();
	
	while ($stmt->fetch())
	{
		$tmp['id']=$id;
		$tmp['user']=$user;
		$count++;
	}

	$stmt->close();
	$conn->close();
		
	if($success && $count==1)
	{
		$result['error']='false';
		$result['list']=$tmp;
	}
	else
		$result['error']='true';
}
else
{
	$result['error']='true';
}

echo json_encode($result);


?> 
